/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package tracker.android.sens.impl;

import ecore.EcorePackage;

import ecore.impl.EcorePackageImpl;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

import tracker.android.com.ComPackage;

import tracker.android.com.impl.ComPackageImpl;

import tracker.android.nativelib.NativelibPackage;
import tracker.android.nativelib.impl.NativelibPackageImpl;
import tracker.android.sens.SensFactory;
import tracker.android.sens.SensPackage;
import tracker.android.sens.Sensor;
import tracker.android.sens.SensorEvent;
import tracker.android.sens.SensorEventListener;
import tracker.android.sens.SensorManager;
import tracker.android.sens.SensorThread;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class SensPackageImpl extends EPackageImpl implements SensPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass sensorEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass sensorEventEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass sensorManagerEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass sensorEventListenerEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass threadEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass sensorThreadEClass = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see tracker.android.sens.SensPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private SensPackageImpl() {
		super(eNS_URI, SensFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link SensPackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static SensPackage init() {
		if (isInited) return (SensPackage)EPackage.Registry.INSTANCE.getEPackage(SensPackage.eNS_URI);

		// Obtain or create and register package
		SensPackageImpl theSensPackage = (SensPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof SensPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new SensPackageImpl());

		isInited = true;

		// Obtain or create and register interdependencies
		ComPackageImpl theComPackage = (ComPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ComPackage.eNS_URI) instanceof ComPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ComPackage.eNS_URI) : ComPackage.eINSTANCE);
		NativelibPackageImpl theNativelibPackage = (NativelibPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(NativelibPackage.eNS_URI) instanceof NativelibPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(NativelibPackage.eNS_URI) : NativelibPackage.eINSTANCE);
		tracker.pc.com.impl.ComPackageImpl theComPackage_1 = (tracker.pc.com.impl.ComPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(tracker.pc.com.ComPackage.eNS_URI) instanceof tracker.pc.com.impl.ComPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(tracker.pc.com.ComPackage.eNS_URI) : tracker.pc.com.ComPackage.eINSTANCE);
		EcorePackageImpl theEcorePackage = (EcorePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI) instanceof EcorePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI) : EcorePackage.eINSTANCE);

		// Create package meta-data objects
		theSensPackage.createPackageContents();
		theComPackage.createPackageContents();
		theNativelibPackage.createPackageContents();
		theComPackage_1.createPackageContents();
		theEcorePackage.createPackageContents();

		// Initialize created meta-data
		theSensPackage.initializePackageContents();
		theComPackage.initializePackageContents();
		theNativelibPackage.initializePackageContents();
		theComPackage_1.initializePackageContents();
		theEcorePackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theSensPackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(SensPackage.eNS_URI, theSensPackage);
		return theSensPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getSensor() {
		return sensorEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getSensorEvent() {
		return sensorEventEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getSensorManager() {
		return sensorManagerEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getSensorEventListener() {
		return sensorEventListenerEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getThread() {
		return threadEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getSensorThread() {
		return sensorThreadEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getSensorThread_SensorManager() {
		return (EReference)sensorThreadEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getSensorThread_LastUpdate() {
		return (EAttribute)sensorThreadEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SensFactory getSensFactory() {
		return (SensFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		sensorEClass = createEClass(SENSOR);

		sensorEventEClass = createEClass(SENSOR_EVENT);

		sensorManagerEClass = createEClass(SENSOR_MANAGER);

		sensorEventListenerEClass = createEClass(SENSOR_EVENT_LISTENER);

		sensorThreadEClass = createEClass(SENSOR_THREAD);
		createEReference(sensorThreadEClass, SENSOR_THREAD__SENSOR_MANAGER);
		createEAttribute(sensorThreadEClass, SENSOR_THREAD__LAST_UPDATE);

		threadEClass = createEClass(THREAD);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		sensorThreadEClass.getESuperTypes().add(this.getThread());
		sensorThreadEClass.getESuperTypes().add(this.getSensorEventListener());

		// Initialize classes and features; add operations and parameters
		initEClass(sensorEClass, Sensor.class, "Sensor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(sensorEventEClass, SensorEvent.class, "SensorEvent", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(sensorManagerEClass, SensorManager.class, "SensorManager", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(sensorEventListenerEClass, SensorEventListener.class, "SensorEventListener", IS_ABSTRACT, IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		EOperation op = addEOperation(sensorEventListenerEClass, null, "onSensorChanged", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, this.getSensorEvent(), "event", 1, 1, IS_UNIQUE, !IS_ORDERED);

		op = addEOperation(sensorEventListenerEClass, null, "onAccuracyChanged", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, this.getSensor(), "sensor", 1, 1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEInt(), "accuracy", 1, 1, IS_UNIQUE, !IS_ORDERED);

		initEClass(sensorThreadEClass, SensorThread.class, "SensorThread", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getSensorThread_SensorManager(), this.getSensorManager(), null, "sensorManager", null, 1, 1, SensorThread.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
		initEAttribute(getSensorThread_LastUpdate(), theEcorePackage.getELong(), "lastUpdate", null, 1, 1, SensorThread.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);

		op = addEOperation(sensorThreadEClass, theEcorePackage.getEByte(), "float2Byte", 0, -1, IS_UNIQUE, !IS_ORDERED);
		addEParameter(op, theEcorePackage.getEFloat(), "inData", 0, -1, IS_UNIQUE, !IS_ORDERED);

		initEClass(threadEClass, tracker.android.sens.Thread.class, "Thread", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		addEOperation(threadEClass, null, "run", 1, 1, IS_UNIQUE, !IS_ORDERED);

		addEOperation(threadEClass, null, "cancel", 1, 1, IS_UNIQUE, !IS_ORDERED);

		// Create resource
		createResource(eNS_URI);
	}

} //SensPackageImpl
